﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace QuaManSys.Rights
{
    public partial class UserManPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Msg", "window.parent.changewin();", true);
            strinfo.InnerHtml = "";
            strinfo.Visible = false;
            if (!IsPostBack)
            {
                btn_search.Attributes.Add("onclick", "return Btn_Search();");
                InitUserInfo();
            }
        }

        /// <summary>
        /// 绑定用户组数据
        /// </summary>
        protected void InitUserInfo()
        {
            DataSet dsUsers;
            string strID = txt_name.Text.Trim();
            if (strID == "")
            {
                dsUsers = QMSDAL.Users.GetAllUsers();
            }
            else
            {
                dsUsers = QMSDAL.Users.GetAUser(strID);
            }
            UserList.DataSource = dsUsers;
            UserList.DataBind();           
        }

        protected void btn_search_Click(object sender, EventArgs e)
        {
            pnlPerson.Visible = true;
            if (txt_name.Text != "")
            {
                InitUserInfo();
            }
        }
    }
}